package com.letoken.platform.app.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.letoken.platform.app.service.AppUserIssueHistoryService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.letoken.platform.pub.req.PageData;
import com.letoken.platform.pub.req.QueryReqBase;
import com.letoken.platform.repo.app.dao.AppUserIssueHistoryMapper;
import com.letoken.platform.repo.app.po.AppUserIssueHistory;
import com.letoken.platform.repo.app.res.config.QueryLetokenHistoryRes;
import com.letoken.platform.repo.utlis.PageDataUtil;
import com.letoken.platform.repo.utlis.WebUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * Le账户-铸币发行,流通,奖励日志 服务实现类
 * </p>
 *
 * @author 作者
 * @since 2023-01-06
 */
@Service
public class AppUserIssueHistoryServiceImpl extends ServiceImpl<AppUserIssueHistoryMapper, AppUserIssueHistory> implements AppUserIssueHistoryService {

    @Autowired
    private AppUserIssueHistoryMapper appUserIssueHistoryMapper;

    @Override
    public PageData<QueryLetokenHistoryRes> queryLetokenHistoryPage(QueryReqBase req) {
        Integer userId = WebUtils.getUserId();
        Page<QueryLetokenHistoryRes> page = new Page<>(req.getPageReq().getPage(),req.getPageReq().getSize());
        return PageDataUtil.getPageData(appUserIssueHistoryMapper.queryLetokenHistoryPage(page,userId));
    }
}
